#include <QApplication>
#include <QColumnView>
#include <QStandardItemModel>
#include <QStandardItem>

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    QColumnView columnView;
    columnView.setWindowTitle("地区选择");

    QStandardItemModel model;

    QStandardItem *china = new QStandardItem("中国");
    QStandardItem *usa = new QStandardItem("美国");

    QStandardItem *guangdong = new QStandardItem("广东");
    guangdong->appendRow(new QStandardItem("广州"));
    guangdong->appendRow(new QStandardItem("深圳"));

    QStandardItem *beijing = new QStandardItem("北京");

    china->appendRow(guangdong);
    china->appendRow(beijing);

    QStandardItem *california = new QStandardItem("加州");
    california->appendRow(new QStandardItem("洛杉矶"));
    california->appendRow(new QStandardItem("旧金山"));

    usa->appendRow(california);

    model.appendRow(china);
    model.appendRow(usa);

    columnView.setModel(&model);
    columnView.resize(500, 300);
    columnView.show();

    return app.exec();
}
